import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';//

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'h-hy';
  playlists:Array<any> = [];
  constructor (public http:HttpClient){}//

  ngOnInit(){
    // console.log("OnInit");
    var url:string = "http://localhost:4000/top/playlist?cat=%E5%8D%8E%E8%AF%AD";//获取http请求
    this.http.get(url).subscribe((res:any)=>{
      console.log(res.playlists)
      this.playlists = res.playlists
      
    })
  }
}
